package com.martin.fastframe.ui.like.follow

import android.animation.AnimatorSet
import android.animation.ObjectAnimator
import android.animation.ValueAnimator
import android.view.View
import com.martin.fastframe.R

/**
 * @desc：视频点赞跟随数据
 */
class VideoLikeFollowData : ILikeFollowData {

    private val iconList = arrayListOf<Any>(R.drawable.img_like_follow)

    override fun getIconList() = iconList

    override fun getIconSize() = 240

    override fun getRotationRange() = -30..30

    override fun getYOffset() = -50

    override fun getAnimatorSet(view: View): AnimatorSet {
        val set = AnimatorSet()

        //放大
        set.playSequentially(
            AnimatorSet().apply {
                playTogether(
                    ObjectAnimator.ofFloat(view, "scaleX", 1f, 1.4f).apply {
                        duration = 50
                    },
                    ObjectAnimator.ofFloat(view, "scaleY", 1f, 1.4f).apply {
                        duration = 50
                    },
                )
            },
            //缩小
            AnimatorSet().apply {
                playTogether(
                    ObjectAnimator.ofFloat(view, "scaleX", 1.4f, 1f).apply {
                        duration = 200
                    },
                    ObjectAnimator.ofFloat(view, "scaleY", 1.4f, 1f).apply {
                        duration = 200
                    },
                )
            },
            ValueAnimator.ofInt(0, 100).apply {
                duration = 200
            },
            //缩放/透明并位移
            AnimatorSet().apply {
                playTogether(
                    ObjectAnimator.ofFloat(view, "scaleX", 1f, 1.8f).apply {
                        duration = 500
                    },
                    ObjectAnimator.ofFloat(view, "scaleY", 1f, 1.8f).apply {
                        duration = 500
                    },
                    ObjectAnimator.ofFloat(view, "alpha", 1f, 0f).apply {
                        duration = 500
                    },
                    ObjectAnimator.ofFloat(
                        view,
                        "translationY",
                        view.y,
                        view.y - 300f
                    ).apply {
                        duration = 500
                    },
                )
            })

        return set
    }
}